// 工单管理请求
import request from '@/utils/request'
/**
 * 工单状态列表
 * @returns Promise
 */
export const workStatusApi = () => request({
  url: '/api/task-service/task/allTaskStatus'
})
/**
 *  工单搜索
 * @param {*} params pageSize  pageSize
 * @returns Promise
 */
export const workSearchApi = params => request({
  url: '/api/task-service/task/search',
  params
})
/**
 * 获取工单详情
 * @param {*} taskId 工单od
 * @param {*} data
 * @returns Promise
 */
export const getWorkInfoByIdApi = (taskId, data) => request({
  url: `/api/task-service/task/taskInfo/${taskId}`,
  data
})

/**
 *  补货详情
 * @param {*} taskId 工单详情里面的货品id
 * @returns Promise
 */
export const getReplenishmentInfo = taskId => request({
  url: `/api/task-service/taskDetails/${taskId}`
})
/**
 * 创建工单
 * @param {createType innerCode  userId productType desc details} data
 * @returns Promise
 */
export const createWork = data => request({
  url: '/api/task-service/task/create',
  method: 'POST',
  data
})
/**
 * 取消工单
 * @param {*} taskId
 * @param {*} data
 * @returns  Promise
 */
export const clearWork = (taskId, desc) => request({
  method: 'POST',
  url: `/api/task-service/task/cancel/${taskId}`,
  data: {
    taskId,
    desc
  }
})
/**
 *  获取补货预警值
 * @param {*} alertValue
 * @returns Promise
 */
export const getWorkValue = alertValue => request({
  url: '/api/task-service/task/supplyAlertValue',
  data: {
    alertValue
  }
})
/**
 *  设置补货预警值
 * @param {*} alertValue
 * @returns Promise
 */
export const setWorkValue = alertValue => request({
  method: 'POST',
  url: '/api/task-service/task/autoSupplyConfig',
  data: {
    alertValue
  }
})
